import 'package:enterprise_v6_app/app/core/core.dart';
import 'package:enterprise_v6_app/app/modules/application/education/course_center/course_center_controller.dart';
import 'package:enterprise_v6_app/app/modules/application/education/course_center/integrated_theme/integrated_theme_view.dart';

///课程中心
class CourseCenterView extends StatelessWidget {
  CourseCenterView({super.key}){
    Get.lazyPut(CourseCenterController.new);
  }

  @override
  Widget build(BuildContext context) {
    final CourseCenterController controller = Get.find<CourseCenterController>();
    return GetBuilder(
      init: controller,
      builder: (_) {
        return Scaffold(
          body: Container(
            color: AppColors.bg_color_grey,
            child: DefaultTabController(
              length: controller.jypxztQ1uSZQaD.length,
              initialIndex: controller.initPage,
              child: Column(
                children: [
                  Container(
                    margin: EdgeInsets.only(left: 14.w, top: 12.w, right: 14.w),
                    padding: EdgeInsets.symmetric(horizontal: 20.w),
                    decoration: BoxDecoration(
                      color: Colors.white,
                      borderRadius: BorderRadius.circular(8),
                    ),
                    height: 54.w,
                    child: TabBar(
                      enableFeedback: false,
                      tabs: controller.jypxztQ1uSZQaD
                          .map(
                            (e) => Tab(text: e.getShowName()),
                          )
                          .toList(),
                      dividerColor: Colors.transparent,
                      labelPadding: EdgeInsets.only(bottom: 10.w),
                      labelStyle: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w500,
                      ),
                      unselectedLabelStyle: TextStyle(
                        fontSize: 16.sp,
                        fontWeight: FontWeight.w500,
                      ),
                      labelColor: Colors.black,
                      unselectedLabelColor: const Color(0xffA0A7B5),
                      indicatorPadding: EdgeInsets.only(top: 36.w, bottom: 10.w),
                      indicator: const BoxDecoration(
                        image: DecorationImage(
                          image: AssetImage(
                            AppImages.icon_app_work_plan,
                          ),
                        ),
                      ),
                    ),
                  ),
                  Expanded(
                    child: Container(
                      color: const Color(0xffF5F5F6),
                      child: TabBarView(
                        children: controller.jypxztQ1uSZQaD.map(IntegratedThemePage.new).toList(),
                      ),
                    ),
                  ),
                ],
              ),
            ),
          ),
        );
      },
    );
  }
}
